i2crepeater 2.2.0
Loading...
Searching...
No Matches
main.c File Reference

I2C Repeater Click example. More...

#include "board.h"
#include "log.h"
#include "i2crepeater.h"

Macros

#define DEVICE_NAME   "6DOF IMU 11 Click"
#define DEVICE_SLAVE_ADDRESS   0x0E
#define DEVICE_REG_ID   0x00
#define DEVICE_ID   0x2D

Functions

void application_init (void)
void application_task (void)
int main (void)

Detailed Description

I2C Repeater Click example.

Description

This example demonstrates the communication through the I2C Repeater Click board. It initializes the device, sets the slave I2C address of an external I2C sensor (e.g. 6DOF IMU 11 Click), and reads its device ID register, verifying if the expected ID is returned.

The demo application is composed of two sections :

Application Init

Initializes the logger and the I2C Repeater Click, then enables the device.

Application Task

Sets the I2C address of a connected I2C sensor and reads its device ID, then logs whether the returned ID matches the expected value.

Note
Make sure to provide the power supply to VCCB side for the connected I2C sensor.
Author
Stefan Filipovic

Macro Definition Documentation

◆ DEVICE_ID

#define DEVICE_ID   0x2D

◆ DEVICE_NAME

#define DEVICE_NAME   "6DOF IMU 11 Click"

◆ DEVICE_REG_ID

#define DEVICE_REG_ID   0x00

◆ DEVICE_SLAVE_ADDRESS

#define DEVICE_SLAVE_ADDRESS   0x0E

Function Documentation

◆ application_init()

void application_init ( void )

< Logger config object.

< Click config object.

Logger initialization. Default baud rate: 115200 Default log level: LOG_LEVEL_DEBUG

Note
If USB_UART_RX and USB_UART_TX are defined as HAL_PIN_NC, you will need to define them manually for log to work. See LOG_MAP_USB_UART macro definition for detailed explanation.

◆ application_task()

void application_task ( void )

◆ main()

int main ( void )